import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

  const routes = [
	{
		path: '*',
		redirect: '/login'
	},
	{
		path: '/test/tree',
		component: () => import('@/views/test/tree')
	}, {
    path: '/login',
    component: () => import('@/views/login/index')
  }, {
		path: '/',
		component: () => import('@/views/index'),
		redirect: '/home',
		meta: {
			loginRequire: true
		},
    children: [
      {
        path: 'home',
        component: () => import('@/views/home/index')
      }, {
        path: 'business/chapter',
        component: () => import('@/views/chapter/index')				
			}, {
        path: 'business/mychapter',
        component: () => import('@/views/chapter/mychapter')				
			}, {
        path: 'business/section',
        component: () => import('@/views/section/index')				
			}, {
        path: 'business/course',
        component: () => import('@/views/course/index')				
			}, {
        path: 'business/category',
        component: () => import('@/views/category/index')				
			}, {
        path: 'business/teacher',
        component: () => import('@/views/teacher/index')				
			}, {
        path: 'file',
        component: () => import('@/views/file/index')				
			}, {
        path: 'system/user',
        component: () => import('@/views/user/index')				
			}, {
        path: 'system/resource',
        component: () => import('@/views/resource/index')				
			}, {
        path: 'system/role',
        component: () => import('@/views/role/index')				
			}
    ]		
	}
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
